package com.baizhi.action;

import com.baizhi.entity.Title;
import com.baizhi.service.TitleService;
import com.baizhi.service.TitleServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class blogServletTest extends HttpServlet {
    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String titlename = request.getParameter("titlename");
        System.out.println("接受标题"+titlename);

        TitleService ts = new TitleServiceImpl();
        Title title = new Title();
        title.setTitle(titlename);

        Title title1 = ts.queryByTitle(title);
        System.out.println("存入内容"+title1);
        request.setAttribute("title1",title1);

        request.getRequestDispatcher("/change_blog.jsp").forward(request,response);
    }
}
